<?php
require("core.php");
$aid = intval($_GET['a']);
if(intval($_GET['a']) < 20000)
{
	$list = getJson("data/list.json");
	if($aid < 1 || $aid > count($list[0])) $aid = 1;
	$ab = $list[0][$aid-1];
	$ad = array("title"=>$ab[1], "aid"=>$aid, 'tpid'=>0);
	
}
else
{
	$ad = $g_db->query("select * from acticle where aid=".intval($_GET['a']));
	$ad = $ad[0];
	$list = $g_db->query("select aid,title from acticle where aid>".(intval($_GET['a'])-10)." limit 10");
}

$dtitle = $ad['title']."-";
$_GET["t"] = $ad['tpid'];
include("include/head.php");
?>
<div class='con'>
<div class='cbody'>
<h2><?php echo $ad['title']; ?></h2>
	<div class="cc">
	<div>
	<div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a></div>
	<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"32"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"32"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
	</div>
	<?php 
	if($aid < 20000)
	{
		echo "<pre style='white-space: pre-wrap;'>";
		include("data/json/".intval($_GET['a']).".json");
		echo "</pre>";
	}
	else
		echo str_replace("\n", "<br/>",$ad['cont']); 
	?>
	</div>
	<div class="ccr">
		<div id="ad3">
		<script type="text/javascript">
			(function() {
				var s = "_" + Math.random().toString(36).slice(2);
				document.write('<div style="" id="' + s + '"></div>');
				(window.slotbydup = window.slotbydup || []).push({
					id: "u2935358",
					container:  s
				});
			})();
		</script>
		</div>		
		<div class='clput'>
			<div class="tt">看了再看</div>
		<?php
		if($aid < 20000)
		{
			$len = count($list[0]);
			for($i=0;$i<10;$i++)
			{
				echo "<a href='view.php?a=",($len-$i),"'>",$list[0][$len-$i-1][1],"</a>";
			}
		}
		else
		{
			foreach($list as $v)
			{
				echo "<a href='view.php?a=",$v['aid'],"'>",$v['title'],"</a>";
			}
		}
		?>
		</div>
	</div>
<div style="clear:both;"></div>
</div>
<!-- UY BEGIN -->
<div id="uyan_frame"></div>
<script type="text/javascript" src="http://v2.uyan.cc/code/uyan.js?uid=2129299"></script>
<!-- UY END -->
</div>
<?php
include("include/foot.php");